//
//  JZAdSDKNativeExpressAd.h
//  JZAdSDK
//
//  Created by 陈坤 on 2025/9/28.
//

#import <Foundation/Foundation.h>
#import "JZAdSDKNativeExpressAdViewDelegate.h"

typedef NSString * JZNativeExpressType NS_EXTENSIBLE_STRING_ENUM;

FOUNDATION_EXPORT JZNativeExpressType _Nonnull const JZNativeExpressTypeLeft;

FOUNDATION_EXPORT JZNativeExpressType _Nonnull const JZNativeExpressTypeImage;

FOUNDATION_EXPORT JZNativeExpressType _Nonnull const JZNativeExpressTypeVerticalImage;

NS_ASSUME_NONNULL_BEGIN

@protocol JZAdSDKNativeExpressAdDelegate;

@interface JZAdSDKNativeExpressAd : NSObject

- (instancetype)new NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;

- (instancetype)initWithAdSize:(CGSize)adSize;

/**
 代理回调
*/
@property (nonatomic, weak) id<JZAdSDKNativeExpressAdDelegate> delegate;

/*
 设置根控制器，用于落地页弹出
 */
@property (nonatomic, weak) UIViewController *controller;

/**
 广告位id
*/
@property (nonatomic, copy) NSString *posId;

/**
 模板样式类型
 */
@property (nonatomic, copy) JZNativeExpressType expressType;

/**
 是否静音，默认静音
 */
@property (nonatomic, assign) BOOL isMuted;

/**
 信息流自动播放，默认WiFi自动播放 开启后WiFi/4G自动播放
 */
@property(nonatomic ,assign) BOOL autoPlay;

/**
 是否展示关闭按钮，默认展示，为YES则不展示
*/
@property (nonatomic, assign) BOOL hiddenCloseBtn;

/**
 加载广告

 @param count 拉取几条广告,建议区间 1~5, 超过可能无法拉取到
 */
- (void)loadNativeExpressAd:(int)count;

/**
 是否正在加载广告
 */
- (BOOL)isLoadingAd;


- (void)setAdScenes:(NSDictionary *)scenes;

/**
 获取广告的竞价价格，单位分，为0则表示未成功获取到广告，或者不支持竞价，开启该功能需要联系媒介商务
 */
- (NSInteger)getBidPrice;
/**
 发送竞价成功上报
 @param price 赢价价格，单位分
 */
- (void)sendWinNotice:(NSInteger)price;

/**
 发送竞价失败上报
 @param price 赢价价格，单位分
 */
- (void)sendLossNotice:(NSInteger)price;

@end

@protocol JZAdSDKNativeExpressAdDelegate <NSObject>

@optional

/**
 信息流模版广告请求成功
 
 @param nativeExpressAd 广告实例
 @param adViewArray 广告模板集合
 */
- (void)JZ_nativeExpressAdSucessToLoad:(JZAdSDKNativeExpressAd *)nativeExpressAd
                     adViewArray:(NSArray<__kindof UIView<JZAdSDKNativeExpressAdViewDelegate> *> *)adViewArray;

/**
 信息流模版广告请求失败
 
 @param nativeExpressAd 广告实例
 @param error 请求错误描述
 */
- (void)JZ_nativeExpressAdFailToLoad:(JZAdSDKNativeExpressAd *)nativeExpressAd
                         error:(NSError *)error;

/**
 信息流模版广告渲染成功
 
 @param adView 广告视图
 */
- (void)JZ_nativeExpressAdViewRenderOrRegistSuccess:(UIView<JZAdSDKNativeExpressAdViewDelegate> *)adView;

/**
 信息流模版广告渲染失败
 
 @param adView 广告视图
 */
- (void)JZ_nativeExpressAdViewRenderOrRegistFail:(UIView<JZAdSDKNativeExpressAdViewDelegate> *)adView;

/**
 信息流模版广告被点击
 
 @param nativeExpressAd 广告模板
 */
- (void)JZ_nativeExpressAdClicked:(JZAdSDKNativeExpressAd *)nativeExpressAd
                     adView:(__kindof UIView<JZAdSDKNativeExpressAdViewDelegate> *)adView;

/**
 信息流模版广告被关闭
 
 @param nativeExpressAd 广告模板
 */
- (void)JZ_nativeExpressAdClose:(JZAdSDKNativeExpressAd *)nativeExpressAd
                   adView:(__kindof UIView<JZAdSDKNativeExpressAdViewDelegate> *)adView;

/**
 信息流模版广告被展示
 
 @param nativeExpressAd 广告实例
 */
- (void)JZ_nativeExpressAdExposure:(JZAdSDKNativeExpressAd *)nativeExpressAd
                      adView:(__kindof UIView<JZAdSDKNativeExpressAdViewDelegate> *)adView;

/**
 信息流模版广告展示上报
 
 @param nativeExpressAd 广告实例
 */
- (void)JZ_nativeExpressAdExposureReport:(JZAdSDKNativeExpressAd *)nativeExpressAd
                            adView:(__kindof UIView<JZAdSDKNativeExpressAdViewDelegate> *)adView;

/**
 信息流模版广告点击上报
 
 @param nativeExpressAd 广告模板
 */
- (void)JZ_nativeExpressAdClickedReport:(JZAdSDKNativeExpressAd *)nativeExpressAd
                           adView:(__kindof UIView<JZAdSDKNativeExpressAdViewDelegate> *)adView;

/**
 信息流模版广告落地页被关闭
 
 @param nativeExpressAd 广告实例
 */
- (void)JZ_nativeExpressAdCloseLandingPage:(JZAdSDKNativeExpressAd *)nativeExpressAd
                              adView:(__kindof UIView<JZAdSDKNativeExpressAdViewDelegate> *)adView;

@end

NS_ASSUME_NONNULL_END
